package com.igoal.comparator;

import java.util.Comparator;

import com.igoal.service.paging.PageItem;

public class GoalEntryComparator extends BaseComparator implements
		Comparator<PageItem<Long>> {

	public GoalEntryComparator(boolean isASC) {
		this.isASC = isASC;
	}

	public int compare(PageItem<Long> o1, PageItem<Long> o2) {
		if (o1 == null || o2 == null) {
			return 0;
		}
		if (isASC) {
			return o1.getSortedValue().compareTo(o2.getSortedValue());
		} else {
			return o2.getSortedValue().compareTo(o1.getSortedValue());
		}
	}

}
